
package jtrimet;

import java.util.*;

public class Response
{
	private Map<String, Location> locationMap = new LinkedHashMap<String, Location>();
	
	private List<Arrival> arrivals = new ArrayList<Arrival>();

	public Location getLocation(String locId)
	{
		return locationMap.get(locId);
	}
	
	public void addArrival(Arrival a)
	{
		this.arrivals.add(a);
		
		Location loc = getLocation(a.getLocationId());
		
		if (loc != null)
		{
			loc.addArrival(a);
		}
	}
	
	public void addLocation(Location loc)
	{
		this.locationMap.put(loc.getLocationId(), loc);
	}
	
	public List<Location> getLocations()
	{
		return new ArrayList<Location>(locationMap.values());
	}


	public List<Arrival> getArrivals()
	{
		return arrivals;
	}

	public void setArrivals(List<Arrival> a)
	{
		this.arrivals = a;
	}
	
	
}
